<%@ page contentType="application/xhtml+xml;charset=utf-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="stripes" uri="http://stripes.sourceforge.net/stripes.tld"%>

<jsp:useBean id="data" scope="page"
             class="cz.muni.fi.xvano1.trinity.supplementary.DataSupplier"/>
<c:if test="${applicationScope.locations eq null}">
    <c:set var="locations" value="${data.locations}"/>
</c:if>
<c:if test="${applicationScope.locations ne null}">
    <c:set var="locations" value="${applicationScope.locations}"/>
</c:if>

<stripes:form beanclass="cz.muni.fi.xvano1.trinity.beans.AddEventActionBean">
    <c:out value="Please insert event parameters."/><br/><br/>
    <c:out value="Quick description: "/><stripes:text name="summary"/><br/>
    <c:out value="Start of event: "/><stripes:text name="start" value="DD/MM/YYYY HH:MM"/><br/>
    <c:out value="End of event: "/><stripes:text name="end" value="DD/MM/YYYY HH:MM"/><br/>
    <c:out value="Recurrence: "/>
    <stripes:select name="recurrence">
        <stripes:option value="">Please select type</stripes:option>
        <stripes:options-collection collection="${data.recurrences}"
                                    label="name" value="name"/>
    </stripes:select><br/>
    <c:out value="All-day event? "/><stripes:checkbox  name="wholeDay"/><br/>
    <c:out value="Location: "/>
    <stripes:select name="location">
        <stripes:option value="">Please select location</stripes:option>
        <stripes:options-collection collection="${locations}"/>
    </stripes:select><br/>
    <stripes:submit name ="addDataConfirm" value="Submit"/>
    <stripes:reset  name="Reset"/>

    <table border="2">
        <thead>
            <tr>
                <th>
                    <c:out value="Toolbox"/>
                </th>
                <th>
                    <c:out value="Count"/>
                </th>
            </tr>
        </thead>
        <tbody>
            <c:forEach items="${allowedKeys}" var="key">
                <tr>     
                    <td>
                        ${key}
                    </td>
                    <td>
                        <stripes:text name="${key}" value="0"/>
                    </td>
                </tr>
            </c:forEach>
        </tbody>
    </table>
</stripes:form>

